var D 	= document;
var c 	= null;
var f 	= new Array();
var coo = new Array();
var fors_cookies = new Array();
var cats_cookies = new Array();

if ( fcookies = my_getcookie('fors') ) {
  coo = fcookies.split(",");
  for( c in coo ) 
  {
	if (coo[c])
	{
		f = coo[c].split("=");
		fors_cookies[ f[0] ] = f[1];
	}
  }
}
if ( ccookies = my_getcookie('cats') ) {
  coo = ccookies.split(",");
  for( c in coo ) 
  {
	if (coo[c])
	{
		f = coo[c].split("=");
		cats_cookies[ f[0] ] = f[1];
	}
  }
}

function my_getcookie(name) {
  var cname = cookieid + name + '=';
  var cpos  = D.cookie.indexOf(cname);
  if (cpos != -1)
  {
	var cstart = cpos + cname.length;
	var cend = D.cookie.indexOf(";", cstart);
	if (cend == -1) { cend = D.cookie.length; }
	return unescape( D.cookie.substring(cstart, cend) );
  }
  return null;
}
function my_setcookie(name, value, sticky) {
  var expire = "";
  var domain = "";
  var path   = "/";
  if ( sticky ) { expire = "; expires=Wed, 1 Jan 2020 00:00:00 GMT"; }
  if ( cookie_domain != "" ) { domain = '; domain=' + cookie_domain; } 
  if ( cookie_path != "" ) { path = cookie_path; }
  D.cookie = cookieid + name + "=" + escape(value) + path + expire + domain + ';';
}
function collect_cookies(coo) {
  var res = new String();
  for( c in coo ) { res += c+"="+coo[c]+","; }
  return res;
}
function setcookief(id,act,url) {
  fors_cookies[id] = act=="+"?1:0;
  my_setcookie('fors', collect_cookies(fors_cookies), 1 );
  if (url) { window.location=base_url+"&f_="+id+"&k="+Math.random()+url; }
}
function setcookiec(id,act,url) {
  cats_cookies[id] = act=="+"?1:0;
  my_setcookie('cats', collect_cookies(cats_cookies), 1);
  if (url) { window.location=base_url+"&f_="+id+"&k="+Math.random()+url; }
}
function RootOpsf(id,ids,act) {

  var obj = new String(ids);
  var arr = obj.split(",");
  var itm_plus = null;
  var itm_minus = null;
  var e = null;
  for( e in arr )
  { 
	itm_plus = get_elem("forum_plus_"+arr[e]);
	itm_minus = get_elem("forum_minus_"+arr[e]);

	if (act == "-")
	{
		if (itm_plus) { itm_plus.style.display = "none"; }
		if (itm_minus) { itm_minus.style.display = "none"; }
	} else
	{
		if(itm_plus&&itm_minus)
		{
			itm_plus.style.display 	= "none";
			itm_minus.style.display = "";
		} else
		{
			if(itm_plus) { itm_plus.style.display = ""; } 
		}
	}
  }
  ShowHide("forum_plus_"+id, "forum_minus_"+id);
  setcookief(id,act);
}
function RootOpsc(id,act) {

  ShowHide("cat_minus_"+id, "cat_plus_"+id);
  setcookiec(id,act);
}